﻿@{
    ViewBag.Title = "GetReturnGood";
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 引入 layui.css -->
</head>
<body>
    <form class="layui-form" action="" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label">销售单号:<span id="SalesOrderCode"></span></label>
            <div class="layui-input-block">
                <input type="text" id="SalesOrderCode" name="SalesOrderCode" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">客户名称</label>
            <div class="layui-input-block">
                <input type="text" id="CustomerName" name="CustomerName" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">产品名称:</label>
            <div class="layui-input-block">
                <input type="text" name="ProductName" id="ProductName" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">产品编号</label>
            <div class="layui-input-block">
                <input type="text" id="ProductCode" name="ProductCode" lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">产品规格</label>
            <div class="layui-input-block">
                <input type="text" id="ProductSpecification" name="ProductSpecification" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单位</label>
            <div class="layui-input-block">
                <input type="text" id="Unit" name="Unit" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单价</label>
            <div class="layui-input-block">
                <input type="text" id="UnitPrice" name="UnitPrice" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
       
        <input type="hidden" id="id" name="id" />
    </form>
    <!-- 引入 layui.js -->
    <script src="~/libs/jquery/jquery.js"></script>
    <script src="~/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['form', 'dropdown', 'laydate', 'jquery'], function () {
            var $ = layui.$;
            var form = layui.form;
            var laydate = layui.laydate;
            var id = window.location.search.substring(4);
            console.log(window.location.search)
            console.log(id)
            //获取退货信息
            function getReturnGood() {
                $.ajax({
                    url: "/ReturnGoods/ReturnGood?id=" + id,
                    type: "get",
                    dataType: "json",
                    success: function (res) {
                        $("#id").val(id);
                        console.log($("#id").val());
                        console.log(res);
                        $('#ProductName').val(res.ProductName);
                        $('#ProductCode').val(res.ProductCode);
                        $('#ProductSpecification').val(res.ProductSpecification);
                        $('#Unit').val(res.Unit);
                        $('#UnitPrice').val(res.UnitPrice);
                        $('#ReturnQuantity').val(res.ReturnQuantity);
                        $('#SalesOrderCode').val(res.SalesOrderCode);        
                        $('#CustomerName').val(res.CustomerName);
                    }
                })
            }
            //获取退货信息
            getReturnGood();



        })
    </script>
</body>
</html>
